<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="renderer" content="webkit">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <link rel="icon" href="<%= BASE_URL %>favicon.ico">
  <title><%= webpackConfig.name %></title>

  <!-- 引入样式 -->
  <!--     <% for(var css of htmlWebpackPlugin.options.cdn.css) { %>
      <link rel="stylesheet" href="<%=css%>">
    <% } %> -->
</head>

<body>
  <div id="app"></div>
  <!-- built files will be auto injected -->
  <noscript>
    <strong>We're sorry but <%= webpackConfig.name %> doesn't work properly without JavaScript enabled. Please enable it
      to continue.</strong>
  </noscript>

  <!--       引入JS-->
  <% for(var js of htmlWebpackPlugin.options.cdn.js) { %>
  <script src="<%=js%>"></script>
  <% } %>
  <script>
    // 动态加载link标签，聚合时，不加载css，独立运行时加载
    if (!window.isInFramework) {
      function addCssByLink(url) {
        var doc = document;
        var link = doc.createElement("link");
        link.setAttribute("rel", "stylesheet");
        link.setAttribute("type", "text/css");
        link.setAttribute("href", url);

        var heads = doc.getElementsByTagName("head");
        if (heads.length)
          heads[0].appendChild(link);
        else
          doc.documentElement.appendChild(link);
      }
      (function () {
        var cssStr = '<%= htmlWebpackPlugin.options.cdn.css %>'
        var cssArray = cssStr.split(',')
        cssArray.forEach(function (item) {
          addCssByLink(item)
        })
      })()
    }
  </script>
</body>

</html>